package com.santu.edu.supporter.biz.team.controller;

import com.santu.edu.supporter.biz.team.pojo.dto.UserTeamDTO;
import com.santu.edu.supporter.biz.team.pojo.param.UserTeamAddParam;
import com.santu.edu.supporter.biz.team.pojo.vo.UserTeamVO;
import com.santu.edu.supporter.biz.team.service.UserTeamService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;

/**
 * @author luoyaoqi
 * @createTime 2024/3/7
 * @description
 */
@RestController
@Validated
@RequiredArgsConstructor
@RequestMapping("user/team")
public class UserTeamController {

    private final UserTeamService userTeamService;

    @PostMapping("add")
    public Boolean addUserAddress(@RequestBody @Valid UserTeamAddParam addParam) {
        return userTeamService.addTeam(addParam);
    }

    @GetMapping("get/team/by/id")
    public UserTeamVO getTeamById(@NotBlank(message = "teamId不能为空") String teamId) {
        return UserTeamVO.convert(userTeamService.getTeamById(teamId));
    }
}
